package com.bdqn.tour.servlet.Yml;


import com.bdqn.tour.pojo.Cityimg;
import com.bdqn.tour.service.CityService;
import com.bdqn.tour.service.impl.CityServiceimpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/jdtp")
public class JdServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置编码
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=utf-8");
        //接收参数
        String id = req.getParameter("deid");
        //获取业务层
        CityService cityService = new CityServiceimpl();
        //调用业务层
        List<Cityimg> getjd = cityService.getjd(id);
        //将数据保存到session中
        req.getSession().setAttribute("getjd", getjd);
        req.getRequestDispatcher("jinjiang.jsp").forward(req, resp);

    }
}
